// -----------------------------------------------------------------------
// <copyright file="EmailAddress.cs" company="Imar.Spaanjaars.Com">
//   Copyright 2008 - 2009 - Imar.Spaanjaars.Com. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------

using System.ComponentModel;
using System.Diagnostics;
using Spaanjaars.Validation;

namespace Spaanjaars.ContactManager.BusinessEntities
{
	/// <summary>
	/// The EmailAddress class represents an e-mail address that belongs to a <see cref="ContactPerson"> contact person</see>.
	/// </summary>
	[DebuggerDisplay("EmailAddress: {Email, nq} ({Type, nq})")]
	public class EmailAddress : BusinessBase
	{
		#region Constructor(s)

		/// <summary>
		/// Initializes a new instance of the EmailAddress class.
		/// </summary>
		public EmailAddress()
		{
			Type = ContactType.None;
		}

		#endregion

		#region Public Properties

		/// <summary>
		/// Gets or sets the unique ID of the e-mail address.
		/// </summary>
		[DataObjectFieldAttribute(true, true, false)]
		public override int Id { get; set; }

		/// <summary>
		/// Gets or sets the actual e-mail address text of the e-mail address.
		/// </summary>
		[NotNullOrEmpty(Key = "EmailNotEmpty")]
		[ValidEmail(Key = "EmailNotValid")]
		public string Email { get; set; }

		/// <summary>
		/// Gets or sets the type of the e-mail address, like business or personal.
		/// </summary>
		[EnumNotNoneAttribute(Key = "ContactTypeNotNone")]
		public ContactType Type { get; set; }

		/// <summary>
		/// Gets or sets the ID of the owner (a <see cref="ContactPerson"/>) of the e-mail address.
		/// </summary>
		public int ContactPersonId { get; set; }

		#endregion
	}
}